<template>
  <div class="wrapper" @click="handleClick">
    <swiper :options="swiperOptions">
      <swiper-slide v-for="(item, index) of img" :key="index">
        <img class="swiper-img"
             :src="item"/>
      </swiper-slide>
      <div class="swiper-pagination" slot="pagination"></div>
    </swiper>
  </div>
</template>

<script>
export default {
  name: 'Gallary',
  props: {
    img: Array
  },
  data() {
    return {
      swiperOptions: {
        pagination: {
          el: '.swiper-pagination',
          type: 'fraction'
        },
        observer: true,
        observeParents: true,
        effect: 'coverflow'
      }
    }
  },
  methods: {
    handleClick() {
      this.$emit('close')
    }
  }
}
</script>

<style lang="stylus" scoped>
  .wrapper >>> .swiper-container
    overflow: inherit
    width: 100%

  .wrapper
    z-index 100
    overflow hidden
    position: fixed
    top: 0
    left: 0
    bottom 0
    right 0
    width: 100%
    height: 100%
    background-color: #000
    display flex
    justify-content: center
    flex-direction: column

    .swiper-img
      width 100%

  .swiper-pagination-fraction, .swiper-pagination-custom, .swiper-container-horizontal > .swiper-pagination-bullets
    bottom: -1rem
    color #fff
</style>
